<template>
    <div class="newsinfo-container">
        <h3 class="tital">{{newsinfo.tital}}</h3>
        <p class="subtital">
            <span>发表时间：{{newsinfo.add_time | dateFormat}}</span>
            <span>点击：{{newsinfo.click}}</span>
        </p>
        <hr>
        <div class="content" v-html="newsinfo.content"></div>

        <!-- 评论区 -->
        <comment-box :id="this.id"></comment-box>

    </div>
</template>

<script>
import {Toase} from 'mint-ui'
import comment from '../subComponents/comment.vue'

export default {
    data(){
        return {
            id: this.$router.params.id,
            newsinfo: [],
        }
    },
    created(){
        this.getNewsInfo()
    },
    methods:{
        getNewsInfo(){
            this.$http.get("/api/getNew" + this.id).then(result => {
                if (result.body.status === 0){
                    this.newsinfo = result.body.message

                }else{
                    Toase('获取新闻详情失败。。。')
                }
            })
        }
    },

    components:{
        "comment-box":comment

    }

}
</script>


<style lang="scss">
.newsinfo-container{
    padding: 0 4px;
    .tital{
        font-size: 16px;
        text-align: center;
        margin: 15px 0;
        color: blue;
    }
    .subtital{
        font-size: 13px;
        color: #226aff;
        display: flex;
        justify-content: space-between;

    }
    .content{
        img{width: 100%}
    }

}

</style>